package com.hzhq.contract.repo;

import com.hzhq.contract.bean.entity.Role;
import org.bson.types.ObjectId;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.mongodb.repository.MongoRepository;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Optional;

/**
 * @author hzhq
 * @create 2021/4/8 11:36 下午
 * @email hzhq1255@163.com
 */
@Repository
public interface RoleRepository extends MongoRepository<Role, ObjectId> {

    Optional<Role> findByRoleNameAndDeleted(String roleName, Integer deleted);

    Optional<Role> findByRoleCodeAndDeleted(Integer roleType, Integer deleted);

    Optional<Role> findByRoleIdAndDeleted(ObjectId roleId, Integer deleted);

    List<Role> findByDeleted(Integer deleted);

    Page<Role> findByDeleted(Integer deleted, Pageable pageable);

    List<Role> findByDeletedAndRoleIdIn(Integer deleted, List<ObjectId> roleIds );


}
